package cn.tedu.apps_system.controller;

import cn.tedu.apps_system.base.response.JsonResult;
import cn.tedu.apps_system.pojo.dto.PoliciesSetDto;
import cn.tedu.apps_system.pojo.dto.PromotionDto;
import cn.tedu.apps_system.pojo.dto.VideoDto;
import cn.tedu.apps_system.pojo.entity.Video;
import cn.tedu.apps_system.service.GovernmentService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "07.助农宣传模块")
@RestController
@RequestMapping("/api/v1/government/")
public class GovernmentController {
    @Autowired
    private GovernmentService governmentService;

    @ApiOperation("添加国家政策宣传功能")
    @ApiOperationSupport(order = 10)
    @PostMapping("private/set")
    public JsonResult setPolicies(@RequestBody PoliciesSetDto policiesSetDto) {
        return governmentService.setPolicies(policiesSetDto);
    }

    @ApiOperation("查询国家政策宣传功能")
    @ApiOperationSupport(order = 20)
    @GetMapping("public/get")
    public JsonResult getPolicies() {
        return governmentService.getList();
    }

    @ApiOperation("添加助农宣传故事")
    @ApiOperationSupport(order = 30)
    @PostMapping("private/add")
    public JsonResult addVideo(@RequestBody VideoDto videoDto) {
        return governmentService.addVideo(videoDto);
    }

    @ApiOperation("查询助农宣传故事")
    @ApiOperationSupport(order = 40)
    @GetMapping("private/sel")
    public JsonResult getVideos(){
        return governmentService.getVideo();
    }

    @ApiOperation("添加助农宣产品")
    @ApiOperationSupport(order = 50)
    @PostMapping("private/addProduct")
    public JsonResult addProduct(@RequestBody PromotionDto promotionDto){
        return governmentService.addProduct(promotionDto);
    }

    @ApiOperation("修改助农宣产品")
    @ApiOperationSupport(order = 60)
    @PostMapping("private/reviseProduct")
    public JsonResult reviseProduct(@RequestBody PromotionDto promotionDto){
        return governmentService.reviseProduct(promotionDto);
    }

    @ApiOperation("查询助农宣产品")
    @ApiOperationSupport(order = 70)
    @GetMapping("public/list")
    public JsonResult getProductList(){
        return governmentService.getProductList();
    }
}